package com.anycl.design.structural.proxy.staticproxy;

import lombok.extern.slf4j.Slf4j;

/**
 * 模拟第三方软件刷票
 */
@Slf4j
public class BuyerProxy implements IBuyer {

    private IBuyer buyer;

    public BuyerProxy(IBuyer buyer) {
        this.buyer = buyer;
    }

    @Override
    public void login(String username, String password) {
        this.buyer.login(username, password);
    }

    @Override
    public void buyTicket() {
        before();
        this.buyer.buyTicket();
        after();
    }

    private void before() {
        log.info("准备定时任务，开始刷票");
    }

    private void after() {
        log.info("刷票成功，短信通知客户");
    }
}
